package Io;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class CopyDemo2 {
    public static void main(String[] args) throws IOException {
        FileInputStream fis = new FileInputStream("./gao.png");
        FileOutputStream fos = new FileOutputStream("./gao_1.png");
        byte [] data = new byte[1024*10];    //10kb 容量数组
        int t;
        long start = System.currentTimeMillis(); //记录开始时间
        while ((t=fis.read(data))!=-1){      //10kb读每次
            fos.write(data,0,t);                //10kb写每次
        }
        long end = System.currentTimeMillis();   //记录结束时间
        System.out.println("复制完毕"+(end-start)+"毫秒");

    }
}
